# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'Project'
        db.create_table('agile_project', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=256)),
            ('completionDate', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
        ))
        db.send_create_signal('agile', ['Project'])

        # Adding model 'Sprint'
        db.create_table('agile_sprint', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=256)),
            ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Project'])),
            ('startDate', self.gf('django.db.models.fields.DateField')()),
            ('endDate', self.gf('django.db.models.fields.DateField')()),
        ))
        db.send_create_signal('agile', ['Sprint'])

        # Adding model 'Priority'
        db.create_table('agile_priority', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
            ('sortOrder', self.gf('django.db.models.fields.IntegerField')()),
        ))
        db.send_create_signal('agile', ['Priority'])

        # Adding model 'Status'
        db.create_table('agile_status', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
            ('sortOrder', self.gf('django.db.models.fields.IntegerField')()),
        ))
        db.send_create_signal('agile', ['Status'])

        # Adding model 'TaskType'
        db.create_table('agile_tasktype', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
            ('sortOrder', self.gf('django.db.models.fields.IntegerField')()),
        ))
        db.send_create_signal('agile', ['TaskType'])

        # Adding model 'Task'
        db.create_table('agile_task', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=256)),
            ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Project'])),
            ('sprint', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Sprint'], null=True, blank=True)),
            ('type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.TaskType'])),
            ('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Task'], null=True, blank=True)),
            ('priority', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Priority'])),
            ('status', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Status'])),
            ('description', self.gf('django.db.models.fields.CharField')(max_length=1024)),
            ('estimatedHours', self.gf('django.db.models.fields.FloatField')()),
            ('workedHours', self.gf('django.db.models.fields.FloatField')()),
        ))
        db.send_create_signal('agile', ['Task'])

        # Adding M2M table for field users on 'Task'
        db.create_table('agile_task_users', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('task', models.ForeignKey(orm['agile.task'], null=False)),
            ('user', models.ForeignKey(orm['auth.user'], null=False))
        ))
        db.create_unique('agile_task_users', ['task_id', 'user_id'])

        # Adding model 'Comment'
        db.create_table('agile_comment', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
            ('tasks', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Task'])),
            ('time', self.gf('django.db.models.fields.DateTimeField')()),
            ('contents', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal('agile', ['Comment'])

        # Adding model 'TaskSearchCriteria'
        db.create_table('agile_tasksearchcriteria', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=256)),
            ('task_name', self.gf('django.db.models.fields.CharField')(max_length=256, null=True, blank=True)),
            ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Project'], null=True, blank=True)),
            ('sprint', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Sprint'], null=True, blank=True)),
            ('type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.TaskType'], null=True, blank=True)),
            ('priority', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Priority'], null=True, blank=True)),
            ('status', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['agile.Status'], null=True, blank=True)),
            ('description', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True, blank=True)),
            ('owner', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
        ))
        db.send_create_signal('agile', ['TaskSearchCriteria'])


    def backwards(self, orm):
        # Deleting model 'Project'
        db.delete_table('agile_project')

        # Deleting model 'Sprint'
        db.delete_table('agile_sprint')

        # Deleting model 'Priority'
        db.delete_table('agile_priority')

        # Deleting model 'Status'
        db.delete_table('agile_status')

        # Deleting model 'TaskType'
        db.delete_table('agile_tasktype')

        # Deleting model 'Task'
        db.delete_table('agile_task')

        # Removing M2M table for field users on 'Task'
        db.delete_table('agile_task_users')

        # Deleting model 'Comment'
        db.delete_table('agile_comment')

        # Deleting model 'TaskSearchCriteria'
        db.delete_table('agile_tasksearchcriteria')


    models = {
        'agile.comment': {
            'Meta': {'object_name': 'Comment'},
            'contents': ('django.db.models.fields.TextField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'tasks': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Task']"}),
            'time': ('django.db.models.fields.DateTimeField', [], {}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
        },
        'agile.priority': {
            'Meta': {'object_name': 'Priority'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'sortOrder': ('django.db.models.fields.IntegerField', [], {})
        },
        'agile.project': {
            'Meta': {'object_name': 'Project'},
            'completionDate': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '256'})
        },
        'agile.sprint': {
            'Meta': {'object_name': 'Sprint'},
            'endDate': ('django.db.models.fields.DateField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Project']"}),
            'startDate': ('django.db.models.fields.DateField', [], {})
        },
        'agile.status': {
            'Meta': {'object_name': 'Status'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'sortOrder': ('django.db.models.fields.IntegerField', [], {})
        },
        'agile.task': {
            'Meta': {'object_name': 'Task'},
            'description': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
            'estimatedHours': ('django.db.models.fields.FloatField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Task']", 'null': 'True', 'blank': 'True'}),
            'priority': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Priority']"}),
            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Project']"}),
            'sprint': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Sprint']", 'null': 'True', 'blank': 'True'}),
            'status': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Status']"}),
            'type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.TaskType']"}),
            'users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'+'", 'symmetrical': 'False', 'to': "orm['auth.User']"}),
            'workedHours': ('django.db.models.fields.FloatField', [], {})
        },
        'agile.tasksearchcriteria': {
            'Meta': {'object_name': 'TaskSearchCriteria'},
            'description': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
            'priority': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Priority']", 'null': 'True', 'blank': 'True'}),
            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Project']", 'null': 'True', 'blank': 'True'}),
            'sprint': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Sprint']", 'null': 'True', 'blank': 'True'}),
            'status': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.Status']", 'null': 'True', 'blank': 'True'}),
            'task_name': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}),
            'type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['agile.TaskType']", 'null': 'True', 'blank': 'True'})
        },
        'agile.tasktype': {
            'Meta': {'object_name': 'TaskType'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'sortOrder': ('django.db.models.fields.IntegerField', [], {})
        },
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        'auth.permission': {
            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        'auth.user': {
            'Meta': {'object_name': 'User'},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        }
    }

    complete_apps = ['agile']